package com.zzptc.tkfate.ui.home;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.zzptc.tkfate.Adapter.ReykAdapter;
import com.zzptc.tkfate.Bean.Reyk;
import com.zzptc.tkfate.R;

import java.util.ArrayList;
import java.util.List;

public class HomeFragment extends Fragment {
    ListView tv_lv;
    List<Reyk> reykList=new ArrayList<>();
    ReykAdapter adapter;
    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.fragment_home, container, false);
        initView(root);
        getData();
        return root;
    }

    private void getData() {
        reykList.add(new Reyk(1,"雷姆","所处地点", R.mipmap.a2));
        reykList.add(new Reyk(2,"雷姆2","所处地点",R.mipmap.a1));
    }

    private void initView(View root) {
        tv_lv=root.findViewById(R.id.tv_lv);
        adapter=new ReykAdapter(getContext(),R.layout.reyk_item,reykList);
        tv_lv.setAdapter(adapter);
    }
}